package com.bridgetree.jubaocrm.ui.widget;

import android.annotation.SuppressLint;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Paint;
import android.util.AttributeSet;
import android.view.View;

@SuppressLint("DrawAllocation")
public class MyDrawView extends View {  

	private float beginX = 0, beginY = 0, endX = 100, endY = 100;  
	private Bitmap bimap;// 用于保存所画图像的图画  


	public void setting(int startX,int startY,int endX,int endY){
		this.beginX = startX;  
		this.beginY = startY;  
		this.endX = endX;  
		this.endY = endY; 
		invalidate(); 
	}

	//构造器
	 public MyDrawView(Context context, AttributeSet attrs) {
	  super(context, attrs);
	 }

	 
	 @SuppressLint("ResourceAsColor")
	@Override
	 protected void onDraw(Canvas canvas) {
	  // TODO Auto-generated method stub
	  super.onDraw(canvas);
	  //绘制黑色背景
	  canvas.drawColor(Color.WHITE);
	  //创建画笔
	  Paint paint = new Paint();
	  //设置画笔颜色为红色
	  paint.setAlpha(120);
	  paint.setColor(Color.BLUE);
      paint.setAntiAlias(true);  
      paint.setStrokeWidth(10);
	  canvas.drawLine(beginX, beginY, endX, endY, paint); 
	 } 
}  
